<?php
namespace app\manager\controller;

use think\Controller;

class Login extends Controller
{
    public function _empty()
    {
        //空操作;
        return redirect('login/index');
    }
    public function index()
    {
        return $this->fetch();
    }

    /*登陆验证*/
    public function login(){
        $param = input('post.');

        if(empty($param['user_name'])){
            return "用户名不能为空！";
        }

        if(empty($param['user_password'])){

            return "密码不能为空！";
        }

        // 验证用户名
        $password=md5($param['user_password']);
        $has = db('manager')
            ->where('m_name', $param['user_name'])
            ->where('m_pass', $password)
            ->find();
        if(empty($has)){

            return '用户名或密码错误';
        }

        session('Muser',$param['user_name']);
        return 200;

    }

}
